{{"{% extends '::base.html.twig' %} "}}
{{"{% block module_name %}"}}{{ entity }}{{"{% endblock %}"}}
{{"{% block title %}"}}{{ entity }}{{"{% endblock %}"}}
{{"{% block body %}"}}
<h2>Listado</h2>
<div class="widget_inside">
    <table class="regular datatables">
        <thead>
            <tr>
        {%- for field, metadata in fields %}
                {%- if loop.first %}
                    <!--<th>{{ field|capitalize }}</th>-->
                {%- else%}
                    <th>{{ field|capitalize }}</th>
                {%- endif%}
        {%- endfor %}
                    <th class="acciones">Acciones</th>
                </tr>
            </thead>
            <tbody>
    {{ '{% for entity in entities %}' }}
                <tr>
    {%- for field, metadata in fields %}
        {%- if loop.first and ('show' in actions) %}
            <!--<td><a href="{{ "{{ path('"~ route_name_prefix ~"_show', { 'id': entity.id }) }}" }}">{{ '{{ entity.'~ field|replace({'_': ''}) ~' }}' }}</a></td>-->
        {%- elseif metadata.type in ['date', 'datetime'] %}
            {%- if metadata.type in ['datetime'] %}
                <td>{{ '{% if entity.'~ field|replace({'_': ''}) ~' %}{{ entity.'~ field|replace({'_': ''}) ~'|date(\'d/m/Y H:i:s\') }}{% endif%}' }}</td>
            {%else%}
                <td>{{ '{% if entity.'~ field|replace({'_': ''}) ~' %}{{ entity.'~ field|replace({'_': ''}) ~'|date(\'d/m/Y\') }}{% endif%}' }}</td>
            {%endif%}
        {%- else %}
            <td>{{ '{{ entity.'~ field|replace({'_': ''}) ~' }}' }}</td>
        {%- endif %}
        {%- if loop.last %}
            <td>
                <div class="acciones">
                    <select class="actions">
                        {%- include "views/others/actions.html.twig" %}
                    </select>
                </div>
            </td>
        {%- endif %}
    {%- endfor %}
                </tr>
    {{ '{% endfor %}' }}
            </tbody>
        </table>
{% if 'new' in actions %}
        <div class="margin_top_15 right">
            <a href="{{ "{{ path('"~ route_name_prefix ~"_new') }}" }}" class="blue button">Agregar</a>
        </div>
{% endif %}
    </div>
{{"{% endblock %}"}}